package com.boang.controller;

import com.boang.entity.req.SmsReq;
import com.boang.entity.resp.Result;
import com.boang.service.SmsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author: 13813
 * @date: 2025/3/4 11:30
 */
@RestController
public class SmsController {

    @Autowired
    private SmsService smsService;

    @PostMapping("/sendSms")
    public Result<String> sendSms(@RequestBody SmsReq smsReq) {
        try {
            return Result.ok(smsService.sendSms(smsReq.getPhone(), smsReq.getMessage()));
        } catch (Exception e) {
            return Result.fail(e.getMessage());
        }
    }
}
